package com.leo.oplayer.view;


import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.leo.oplayer.R;
import com.leo.oplayer.adapter.WhitePersonAdapter;
import com.leo.oplayer.dao.DBService;
import com.leo.oplayer.model.WhitePerson;

public class WhiteListView extends Activity {
	
//	private static final String TAG = "WhiteListView";

	private DBService service;
	
	private ListView mylist;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);		
		this.setContentView(R.layout.adapter_list);
		
		service = new DBService(this);
		List<WhitePerson> list = service.searchWhiteList(null);
		ArrayAdapter<WhitePerson> adapter = new WhitePersonAdapter(this,R.layout.white_person,list);        
		
		mylist = (ListView) findViewById(R.id.ListView01);
		mylist.setAdapter(adapter);
		
		//简单游标的情况
//		Cursor cursor = service.searchWhiteList();
//		ListAdapter adapter = new SimpleCursorAdapter(this,
//                android.R.layout.simple_list_item_1, // Use a template that displays a text view
//                cursor, // Give the cursor to the list adatper
//                new String[] {People.NAME}, // Map the NAME column in the people database to...                                            
//                new int[] {android.R.id.text1}); // The "text1" view defined in the XML template
	}
	
	

}
